import React from 'react';
import { Router, Route, Switch, Redirect } from 'dva/router';
import IndexPage from './routes/IndexPage';
import Login from './routes/Login';
import Navigation from './routes/Navigation';
import History from './routes/HistoryData';
function RouterConfig({ history }) {
  return (
    <Router history={history}>
      <Navigation>
        <Switch>
          <Route path="/" exact render={()=> { return localStorage.getItem("login") ? <Redirect to="/home"/>: <Redirect to="/login" component={Login}/> } }/>
          <Route path="/home" exact component={IndexPage} />
          <Route path="/history" exact component={History} />
        </Switch>
      </Navigation>
    </Router>
  );
}

export default RouterConfig;
